/*
 * LauncherActivity.h
 *
 *  Created on: 2021年9月7日
 *      Author: vicent-PC
 */
#ifndef MAIN_ROSE_APP_LAUNCHERACTIVITY_H_
#define MAIN_ROSE_APP_LAUNCHERACTIVITY_H_

#include "./websocket/WebSocketService.h"
#include "Activity.h"
#include "Canvas.h"
#include "WebService.h"
#include "power_track/Ina226App.h"
#include "SystemServer.h"

class LauncherActivity : public Activity {
 public:
    static constexpr const char* APPNAME = "Launcher";
    static LauncherActivity* getInstance() {
        if (m_pInstance == nullptr) m_pInstance = new LauncherActivity();
        return m_pInstance;
    }

    LauncherActivity();
    virtual ~LauncherActivity();
    virtual void onCreate();
    virtual void onEvent();
    void initDisplay();
    virtual void onDraw();
    void setupWifiThread();
    void onWifiConnected();
 public:
    bool mWifiConnected = false;
    uint32_t mIp = 0;
    char mIpStr[32] = {0};
    static LauncherActivity * m_pInstance;
 private:
    View* mView = nullptr;
    Canvas* mCanvas = nullptr;

    WebSocketService* mWebSocketServer = nullptr;
    Ina226App mInaApp;
    bool mInaAppInited = false;
};

#endif /* MAIN_ROSE_APP_LAUNCHERACTIVITY_H_ */
